package com.hsc.yalebao.tabIndex;

import android.annotation.SuppressLint;
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.format.DateUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;
import com.google.gson.Gson;
import com.handmark.pulltorefresh.library.ILoadingLayout;
import com.handmark.pulltorefresh.library.PullToRefreshBase;
import com.handmark.pulltorefresh.library.PullToRefreshBase.Mode;
import com.handmark.pulltorefresh.library.PullToRefreshBase.OnRefreshListener;
import com.handmark.pulltorefresh.library.PullToRefreshListView;
import com.hsc.yalebao.adapter.RemoveNobibiListAdapter;
import com.hsc.yalebao.base.ActivityStack;
import com.hsc.yalebao.base.BaseActivity;
import com.hsc.yalebao.base.CustomApplication;
import com.hsc.yalebao.base.MainActivity;
import com.hsc.yalebao.http.AppConstants;
import com.hsc.yalebao.http.RequestNet;
import com.hsc.yalebao.model.BaseDataObject;
import com.hsc.yalebao.model.NobibiBaseModel;
import com.hsc.yalebao.model.NobibiListBean;
import com.hsc.yalebao.model.UserBaseBean;
import com.hsc.yalebao.tools.UiUtil;
import com.hsc.yalebao.weight.LogUtils;
import com.zhy.http.okhttp.callback.StringCallback;
import java.util.ArrayList;
import java.util.HashMap;
import okhttp3.Call;

public class RemoveNobibiActivity extends BaseActivity
{
  public static final int IMG_JIECHU_CLICK = 1;
  private String TAG = "RemoveNobibiActivity";
  private RemoveNobibiListAdapter adapter;
  private View contentView;
  private Context context;
  private View emptyView;
  private boolean isEnd = false;
  private boolean isRefesh = true;
  private int itemPosition = -1;
  private ImageView iv_title_right;
  private Handler mItemClickHandler = new Handler()
  {
    public void handleMessage(Message paramAnonymousMessage)
    {
      switch (paramAnonymousMessage.what)
      {
      default:
        return;
      case 1:
      }
      RemoveNobibiActivity.this.itemPosition = ((Integer)paramAnonymousMessage.obj).intValue();
      NobibiBaseModel localNobibiBaseModel = (NobibiBaseModel)RemoveNobibiActivity.this.result.get(RemoveNobibiActivity.this.itemPosition);
      RemoveNobibiActivity.this.setUserNobibiState(localNobibiBaseModel);
    }
  };
  private PullToRefreshListView mPullRefreshListView;
  private int memberid;
  View.OnClickListener onClickListener = new View.OnClickListener()
  {
    public void onClick(View paramAnonymousView)
    {
      switch (paramAnonymousView.getId())
      {
      case 2131099704:
      default:
        return;
      case 2131099699:
      }
      CustomApplication.app.finishActivity(RemoveNobibiActivity.this);
    }
  };
  private int page = 1;
  private ArrayList<NobibiBaseModel> result = new ArrayList();
  private View view_title;

  private void getNobibiList()
  {
    HashMap localHashMap = new HashMap();
    localHashMap.put("pagesize", "10");
    localHashMap.put("page", this.page);
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_TOP10NOWORDSUSER);
    RequestNet.get(this.context, AppConstants.URL_GET_TOP10NOWORDSUSER, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        LogUtils.e(RemoveNobibiActivity.this.TAG, "获取失败,获取解除禁言列表:" + paramAnonymousException);
        RemoveNobibiActivity.this.mPullRefreshListView.onRefreshComplete();
        RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
      }

      public void onResponse(String paramAnonymousString)
      {
        RemoveNobibiActivity.this.mPullRefreshListView.onRefreshComplete();
        LogUtils.d(RemoveNobibiActivity.this.TAG, "result:数据" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
        {
          LogUtils.d(RemoveNobibiActivity.this.TAG, "为空时result:" + paramAnonymousString);
          RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
          return;
        }
        Gson localGson = new Gson();
        try
        {
          localNobibiListBean = (NobibiListBean)localGson.fromJson(paramAnonymousString, NobibiListBean.class);
          if (localNobibiListBean == null)
          {
            LogUtils.e(RemoveNobibiActivity.this.TAG, "RemoveNobibiBean== null，获取失败");
            RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
            return;
          }
        }
        catch (Exception localException)
        {
          NobibiListBean localNobibiListBean;
          while (true)
          {
            localException.printStackTrace();
            localNobibiListBean = null;
          }
          if (localNobibiListBean.getFlag() == -4)
          {
            ActivityStack.getInstance().backToMain(MainActivity.class, RemoveNobibiActivity.this.context);
            return;
          }
          if (localNobibiListBean.getFlag() == 1)
          {
            if (localNobibiListBean.getResult() == null)
            {
              LogUtils.e(RemoveNobibiActivity.this.TAG, "bean.getResult() == null");
              return;
            }
            RemoveNobibiActivity.this.result.addAll(localNobibiListBean.getResult());
            if (RemoveNobibiActivity.this.result.size() == 0)
              RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
            LogUtils.e(RemoveNobibiActivity.this.TAG, "result.size():" + RemoveNobibiActivity.this.result.size());
            if (RemoveNobibiActivity.this.result.size() < 10);
            for (RemoveNobibiActivity.this.isEnd = true; ; RemoveNobibiActivity.this.isEnd = false)
            {
              RemoveNobibiActivity.this.adapter.setData(RemoveNobibiActivity.this.result);
              RemoveNobibiActivity.this.adapter.notifyDataSetChanged();
              return;
            }
          }
          if (localNobibiListBean.getFlag() == -2)
          {
            RemoveNobibiActivity.this.showDownWireDialog();
            return;
          }
          LogUtils.e(RemoveNobibiActivity.this.TAG, "RemoveNobibiBean.getFlag() != 1&&-2");
          RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
        }
      }
    });
  }

  private void init()
  {
    this.emptyView = LayoutInflater.from(this.context).inflate(2130903139, null);
    this.mPullRefreshListView = ((PullToRefreshListView)findViewById(2131099717));
    this.mPullRefreshListView.setMode(PullToRefreshBase.Mode.BOTH);
    this.mPullRefreshListView.setOnRefreshListener(new PullToRefreshBase.OnRefreshListener()
    {
      public void onRefresh(PullToRefreshBase<ListView> paramAnonymousPullToRefreshBase)
      {
        String str = DateUtils.formatDateTime(RemoveNobibiActivity.this.getApplicationContext(), System.currentTimeMillis(), 524305);
        paramAnonymousPullToRefreshBase.getLoadingLayoutProxy().setLastUpdatedLabel(str);
        if (RemoveNobibiActivity.this.mPullRefreshListView.isHeaderShown())
        {
          RemoveNobibiActivity.this.isRefesh = true;
          LogUtils.e(RemoveNobibiActivity.this.TAG, "mPullRefreshListView刷新");
          RemoveNobibiActivity.this.refeshNobibiList();
          return;
        }
        RemoveNobibiActivity.this.isRefesh = false;
        LogUtils.e(RemoveNobibiActivity.this.TAG, "mPullRefreshListView加载");
        if (RemoveNobibiActivity.this.isEnd)
          UiUtil.showToast(RemoveNobibiActivity.this.context, "暂无更多数据");
        RemoveNobibiActivity localRemoveNobibiActivity = RemoveNobibiActivity.this;
        localRemoveNobibiActivity.page = (1 + localRemoveNobibiActivity.page);
        RemoveNobibiActivity.this.getNobibiList();
      }
    });
    if (this.adapter == null)
    {
      this.adapter = new RemoveNobibiListAdapter(this.context, this.result, this.mItemClickHandler);
      this.mPullRefreshListView.setAdapter(this.adapter);
    }
    this.adapter.notifyDataSetChanged();
  }

  private void refeshNobibiList()
  {
    this.page = 1;
    HashMap localHashMap = new HashMap();
    localHashMap.put("pagesize", "10");
    localHashMap.put("page", this.page);
    LogUtils.d(this.TAG, "URL:" + AppConstants.URL_GET_TOP10NOWORDSUSER);
    RequestNet.get(this.context, AppConstants.URL_GET_TOP10NOWORDSUSER, localHashMap, new StringCallback()
    {
      public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
      {
        LogUtils.e(RemoveNobibiActivity.this.TAG, "获取失败,获取解除禁言列表:" + paramAnonymousException);
        RemoveNobibiActivity.this.mPullRefreshListView.onRefreshComplete();
        RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
      }

      public void onResponse(String paramAnonymousString)
      {
        RemoveNobibiActivity.this.mPullRefreshListView.onRefreshComplete();
        LogUtils.d(RemoveNobibiActivity.this.TAG, "result:数据" + paramAnonymousString);
        if (UiUtil.IsValueEmpty(paramAnonymousString))
        {
          LogUtils.d(RemoveNobibiActivity.this.TAG, "为空时result:" + paramAnonymousString);
          RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
          return;
        }
        Gson localGson = new Gson();
        try
        {
          localNobibiListBean = (NobibiListBean)localGson.fromJson(paramAnonymousString, NobibiListBean.class);
          if (localNobibiListBean == null)
          {
            Log.e(RemoveNobibiActivity.this.TAG, "RemoveNobibiBean== null，获取失败");
            RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
            return;
          }
        }
        catch (Exception localException)
        {
          NobibiListBean localNobibiListBean;
          while (true)
          {
            localException.printStackTrace();
            localNobibiListBean = null;
          }
          if (localNobibiListBean.getFlag() == -4)
          {
            ActivityStack.getInstance().backToMain(MainActivity.class, RemoveNobibiActivity.this.context);
            return;
          }
          if (localNobibiListBean.getFlag() == 1)
          {
            if (localNobibiListBean.getResult() == null)
            {
              LogUtils.e(RemoveNobibiActivity.this.TAG, "bean.getResult() == null");
              return;
            }
            if (RemoveNobibiActivity.this.result != null)
              RemoveNobibiActivity.this.result.clear();
            RemoveNobibiActivity.this.result.addAll(localNobibiListBean.getResult());
            if (RemoveNobibiActivity.this.result.size() == 0)
              RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
            LogUtils.e(RemoveNobibiActivity.this.TAG, "result.size():" + RemoveNobibiActivity.this.result.size());
            RemoveNobibiActivity.this.adapter.setData(RemoveNobibiActivity.this.result);
            RemoveNobibiActivity.this.adapter.notifyDataSetChanged();
            return;
          }
          if (localNobibiListBean.getFlag() == -2)
          {
            RemoveNobibiActivity.this.showDownWireDialog();
            return;
          }
          LogUtils.e(RemoveNobibiActivity.this.TAG, "RemoveNobibiBean.getFlag() != 1&&-2");
          RemoveNobibiActivity.this.mPullRefreshListView.setEmptyView(RemoveNobibiActivity.this.emptyView);
        }
      }
    });
  }

  private void setUserNobibiState(NobibiBaseModel paramNobibiBaseModel)
  {
    String str = "";
    int i;
    if (paramNobibiBaseModel != null)
    {
      str = paramNobibiBaseModel.getMemberid();
      i = -1;
      if (CustomApplication.app.userBaseBean == null)
        break label165;
      i = CustomApplication.app.userBaseBean.getMemberid();
    }
    while (true)
    {
      HashMap localHashMap = new HashMap();
      localHashMap.put("memberid", i);
      localHashMap.put("banMemberid", str);
      localHashMap.put("banType", "");
      localHashMap.put("state", "2");
      LogUtils.d(this.TAG, "URL:" + AppConstants.URL_ROOM_SETROOMNOWORD);
      RequestNet.get(this.context, AppConstants.URL_ROOM_SETROOMNOWORD, localHashMap, new StringCallback()
      {
        public void onError(Call paramAnonymousCall, Exception paramAnonymousException)
        {
          LogUtils.e(RemoveNobibiActivity.this.TAG, "解禁失败,setUserNobibiState-result:" + paramAnonymousException);
        }

        public void onResponse(String paramAnonymousString)
        {
          LogUtils.d(RemoveNobibiActivity.this.TAG, "result:" + paramAnonymousString);
          Gson localGson = new Gson();
          try
          {
            localBaseDataObject = (BaseDataObject)localGson.fromJson(paramAnonymousString, BaseDataObject.class);
            if (localBaseDataObject == null)
              return;
          }
          catch (Exception localException)
          {
            BaseDataObject localBaseDataObject;
            do
            {
              while (true)
              {
                localException.printStackTrace();
                localBaseDataObject = null;
              }
              if (localBaseDataObject.getFlag() == -4)
              {
                ActivityStack.getInstance().backToMain(MainActivity.class, RemoveNobibiActivity.this.context);
                return;
              }
              if (localBaseDataObject.getFlag() == -2)
              {
                RemoveNobibiActivity.this.showDownWireDialog();
                return;
              }
              if (localBaseDataObject.getFlag() == -3)
                RemoveNobibiActivity.this.ShowFengjinDialog();
              if (localBaseDataObject.getFlag() == 0)
              {
                UiUtil.showToast(RemoveNobibiActivity.this.context, localBaseDataObject.getMsg());
                return;
              }
            }
            while (localBaseDataObject.getFlag() != 1);
            LogUtils.i(RemoveNobibiActivity.this.TAG, "解禁成功");
            UiUtil.showToast(RemoveNobibiActivity.this.context, "解禁成功");
            RemoveNobibiActivity.this.refeshNobibiList();
          }
        }
      });
      return;
      LogUtils.e(this.TAG, "itemChatMsgEntity == null");
      break;
      label165: LogUtils.e(this.TAG, "memberid == null");
    }
  }

  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    this.context = this;
    this.contentView = LayoutInflater.from(this.context).inflate(2130903077, null);
    setContentView(this.contentView);
    CustomApplication.app.addActivity(this);
    setTitle(8, 0, 2130837809, "解除禁言", 0, 8, 8, 0, true);
    init();
    if (CustomApplication.app.userBaseBean != null)
      this.memberid = CustomApplication.app.userBaseBean.getMemberid();
    getNobibiList();
  }

  protected void onResume()
  {
    super.onResume();
  }

  @SuppressLint({"NewApi"})
  public void setTitle(int paramInt1, int paramInt2, int paramInt3, String paramString, int paramInt4, int paramInt5, int paramInt6, int paramInt7, boolean paramBoolean)
  {
    View localView = findViewById(2131099716);
    if (paramBoolean)
      localView.setVisibility(0);
    while (true)
    {
      ((TextView)localView.findViewById(2131099701)).setText(paramString);
      ((TextView)localView.findViewById(2131099700)).setVisibility(paramInt1);
      ImageView localImageView = (ImageView)localView.findViewById(2131099699);
      localImageView.setVisibility(paramInt2);
      localImageView.setOnClickListener(this.onClickListener);
      localImageView.setImageResource(paramInt3);
      TextView localTextView = (TextView)localView.findViewById(2131099702);
      localTextView.setVisibility(paramInt5);
      localTextView.setOnClickListener(this.onClickListener);
      this.iv_title_right = ((ImageView)localView.findViewById(2131099704));
      this.iv_title_right.setVisibility(paramInt6);
      this.iv_title_right.setOnClickListener(this.onClickListener);
      this.iv_title_right.setImageResource(paramInt7);
      return;
      localView.setVisibility(8);
    }
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.hsc.yalebao.tabIndex.RemoveNobibiActivity
 * JD-Core Version:    0.6.2
 */